// 1. 封装单独的 router.js 路由模块文件
import express from 'express'
import { handler, handlerAdd, handlerDelete, handlerUpdate } from '../controllers/dr/index.js'
import { handlerUserRegister } from '../controllers/user/index.js'
// 创建路由对象
const router = express.Router()

// catch(next)统一捕获异常，处理层在src/_helpers/errorHanlder.js
router.get('/', ()=>{})
router.post('/add', (req, res, next) => handlerAdd(req, res, next).catch(next))
router.post('/delete', (req, res, next) => handlerDelete(req, res, next).catch(next))
router.post('/update', (req, res, next) => handlerUpdate(req, res, next).catch(next))
router.get('/dr', (req, res, next) => handler(req, res, next).catch(next))
router.get('/about', ()=>{})
// 用户注册
router.post('/user/register', (req, res, next) => handlerUserRegister(req, res, next).catch(next))

export default router
